using System.Configuration;

namespace Common.Configuration.Listener
{
    public class PrefixElement : ConfigurationElement
    {
        private const string HostPropertyName = "host";
        private const string ProtocolPropertyName = "proto";
        private const string PortPropertyName = "port";

        [ConfigurationProperty(ProtocolPropertyName)]
        public string Protocol
        {
            get { return (string) this[ProtocolPropertyName]; }
            set { this[ProtocolPropertyName] = value; }
        }

        [ConfigurationProperty(HostPropertyName)]
        public string Host
        {
            get { return (string) this[HostPropertyName]; }
            set { this[HostPropertyName] = value; }
        }

        [ConfigurationProperty(PortPropertyName)]
        public string Port
        {
            get { return (string) this[PortPropertyName]; }
            set { this[PortPropertyName] = value; }
        }

        public string FullValue
        {
            get { return string.Format("{0}://{1}:{2}/", Protocol, Host, Port); }
        }
    }
}